package com.suning.sawp.service.util;

import org.apache.commons.lang3.ObjectUtils;

/**
 * 
 * 
 * 功能描述： ftp 配置
 * 
 * @author 作者 12072522@cnsuning.com
 * @created 2014-12-17 上午11:11:30
 * @version 1.0.0
 * @date 2014-12-17 上午11:11:30
 */
public class FtpConfig {

    /**
     * 服务器地址
     */
    private String host;

    /**
     * 端口
     */
    private int port;

    /**
     * 用户名
     */
    private String userName;

    /**
     * 密码
     */
    private String password;

    /**
     * 主服务器标志
     */
    private boolean master;
    
    /**
     * 域名
     */
    private String domain;

    public FtpConfig(String host, int port, String userName, String password,boolean master) {
        this.host = host;
        this.password = password;
        this.userName = userName;
        this.port = port;
        this.master = master;
    }
    
    public FtpConfig(String host, int port, String userName, String password,boolean master, String domain) {
        this.host = host;
        this.password = password;
        this.userName = userName;
        this.port = port;
        this.master = master;
        this.domain = domain;
    }

    public FtpConfig(String host, int port) {
        this(host, port, null, null,false);
    }

    /**
     * @return the port
     */
    public int getPort() {
        return port;
    }

    /**
     * @param port the port to set
     */
    public void setPort(int port) {
        this.port = port;
    }

    /**
     * @return the userName
     */
    public String getUserName() {
        return userName;
    }

    /**
     * @param userName the userName to set
     */
    public void setUserName(String userName) {
        this.userName = userName;
    }

    /**
     * @return the password
     */
    public String getPassword() {
        return password;
    }

    /**
     * @param password the password to set
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * @return the host
     */
    public String getHost() {
        return host;
    }

    /**
     * @param host the host to set
     */
    public void setHost(String host) {
        this.host = host;
    }

    @Override
    public int hashCode() {
        return ObjectUtils.hashCodeMulti(host, port);
    }

    /**
     * 
     * 节点比较
     */
    @Override
    public boolean equals(Object obj) {
        if (obj instanceof FtpConfig) {
            FtpConfig other = (FtpConfig) obj;
            return ObjectUtils.equals(host, other.getHost()) && ObjectUtils.equals(port, other.getPort());
        } else {
            return false;
        }
    }

    /**
     * @return the master
     */
    public boolean isMaster() {
        return master;
    }

    /**
     * @param master the master to set
     */
    public void setMaster(boolean master) {
        this.master = master;
    }

    public String getDomain() {
        return domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

}
